<template>
    <view class="tab-container">
        <view class="left">
            <tm-icon color="#fff" :font-size="20" name="tmicon-angle-left"></tm-icon>
        </view>
        <view v-for="(item, index) in tabList" class="tablist" :class="{ 'actived': item.type === activedTab }">
            <view class="text">
                {{ item.name }}
            </view>
        </view>
        <view class="right">
            <tm-icon color="#fff" :font-size="20" name="tmicon-angle-right"></tm-icon>
        </view>
    </view>
</template>
<script setup lang="ts">
import { ref } from 'vue'
const tabList = [
    { name: '情感姻缘', type: 'love' },
    { name: '健康长寿', type: 'health' },
    { name: '财富自由', type: 'money' },
]

const activedTab = ref('love')
</script>
<style lang="less" scoped>
.tab-container {
    display: flex;
    justify-content: space-between;
    padding: 0 80rpx;
    position: relative;

    .right,
    .left {
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
        z-index: 1;
        left: 28rpx;
        width: 32rpx;
        height: 32rpx;
        border-radius: 50%;
        background-color: #A37C3D;
        display: flex;
        justify-content: center;
        align-items: center;
    }

    .right {
        left: auto;
        right: 28rpx;
    }
}

.tablist {
    width: 150rpx;
    height: 150rpx;
    background-image: url('/static/assets/images/blessings/tab-bg.png');
    background-repeat: no-repeat;
    background-size: 100% 100%;
    color: #A37C3D;
    font-weight: bold;
    font-size: 28rpx;
    display: flex;
    justify-content: center;
    align-items: center;

    .text {
        width: 56rpx;
    }

    &.actived {
        background-image: url('/static/assets/images/blessings/tab-bg-actived.png');
        color: #fff;
    }
}
</style>